/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.opgea.appstreet.domain.entities;

import java.io.Serializable;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Ramesh
 */
@Entity
@Table(name = "customerlogin")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "CustomerLogin.findAll", query = "SELECT c FROM CustomerLogin c"),
    @NamedQuery(name = "CustomerLogin.findById", query = "SELECT c FROM CustomerLogin c WHERE c.id = :id"),
    @NamedQuery(name = "CustomerLogin.findByIsActive", query = "SELECT c FROM CustomerLogin c WHERE c.isActive = :isActive"),
    @NamedQuery(name = "CustomerLogin.findByLoginId", query = "SELECT c FROM CustomerLogin c WHERE c.loginId = :loginId"),
    @NamedQuery(name = "CustomerLogin.findByPassword", query = "SELECT c FROM CustomerLogin c WHERE c.password = :password")})
public class CustomerLogin implements Serializable {
    
    @Id
    @GeneratedValue
    private Long id;
    private String loginId;
    private String password;
    private boolean isActive;
    @OneToOne(cascade= CascadeType.ALL)
    private Customer customer;

    public CustomerLogin() {
    }

    public Customer getCustomer() {
        return customer;
    }

    public void setCustomer(Customer customer) {
        this.customer = customer;
    }

  
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public boolean isIsActive() {
        return isActive;
    }

    public void setIsActive(boolean isActive) {
        this.isActive = isActive;
    }

    public String getLoginId() {
        return loginId;
    }

    public void setLoginId(String loginId) {
        this.loginId = loginId;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final CustomerLogin other = (CustomerLogin) obj;
        if (this.id != other.id && (this.id == null || !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public int hashCode() {
        int hash = 5;
        hash = 79 * hash + (this.id != null ? this.id.hashCode() : 0);
        return hash;
    }

    @Override
    public String toString() {
        return "CustomerLogin{" + "id=" + id + ", loginId=" + loginId + ", password=" + password + ", isActive=" + isActive + ", customer=" + customer + '}';
    }

   
    
}
